const getMappedRoutes = (r) => (
  r.map(route => ({
    ...route,
    component: (resolve) => require([`../pages/${route.page}`], resolve),
    children: route.children ? getMappedRoutes(route.children) : undefined
  }))
)

const routes = [{
  path: '/',
  name: '首页',
  page: 'App/App.vue',
  children: [{
    path: '/overview',
    name: '概览',
    page: 'Overview/Overview.vue',
  }, {
    path: '/version',
    name: '版本管理',
    page: 'Version/Version.vue',
  }, {
    path: '/details',
    name: '版本详情',
    page: 'Version/Details.vue',
  }, {
    path: '/record',
    name: '每日版本',
    page: 'Version/Record.vue',
  }, {
    path: '/demand',
    name: '需求管理',
    page: 'Demand/Demand.vue',
  }, {
    path: '/department',
    name: '部门管理',
    page: 'Department/Department.vue',
  }, {
    path: '/demandlist',
    name: '需求管理',
    page: 'Demand/DemandList.vue',
  }, {
    path: '/demanddetails',
    name: '需求管理',
    page: 'Demand/DemandDetails.vue',
  }, {
    path: '/system',
    name: '系统管理',
    page: 'System/SysManagement.vue',
  }]
}]

export default getMappedRoutes(routes)